package biz.ezcom.design.pattern.commond;

import java.util.ArrayList;
import java.util.List;

public class InvokerWaiter {
	private List<Commond> orderList = new ArrayList<Commond>();
	
	public void addCommond(Commond commond){
		if(commond.getClass() == CommondBakeChickenWing.class){
			System.out.println("服务员说：鸡翅没有了，请点别的！");
		}else if(commond.getClass() == CommondBakeMutton.class){
			System.out.println("增加了CommondBakeMutton 烤肉串");
			orderList.add(commond);
		}
	}
	public void removeCommond(Commond commond){
		System.out.println("取消订单" + commond);
		orderList.remove(commond);
	}
	public void submit(){
		for(Commond commond : orderList){
			commond.executeCommond();
		}
	}
}
